package com.zhangfei.order.biz.manager.impl;

import com.zhangfei.order.biz.domain.dto.ProductInfoDTO;
import com.zhangfei.order.biz.manager.OrderManager;
import com.zhangfei.order.biz.third.ProductGrpcClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class OrderManagerImpl implements OrderManager {

    @Resource
    ProductGrpcClient productGrpcClient;

    @Override
    public boolean confirm(String productId) {
        try {
            //1.查询产品信息
            ProductInfoDTO productInfoDTO = productGrpcClient.queryProduct(productId);
            //2.逻辑处理
            //........................

//            double a=1/0;
        } catch (Exception e) {
            log.error("下单失败", e);
            throw new RuntimeException("11111");
        }


        return true;
    }
}
